function q = eq(A,B)
% BVQXfile::eq  - overloaded method

% Version:  v0.8a
% Build:    9112206
% Date:     Nov-22 2009, 6:11 AM CET
% Author:   Jochen Weber, SCAN Unit, Columbia University, NYC, NY, USA
% URL/Info: http://wiki.brainvoyager.com/BVQXtools

% check sizes first
szA = size(A);
szB = size(B);
if ~isequal(szA, szB) && ...
    numel(A) ~= 1 && ...
    numel(B) ~= 1
    error( ...
        'BVQXfile:InvalidCall', ...
        'A call to eq(OBJ,OBJ) requires two same-sized or one scalar.' ...
    );
end

% prepare output
if ~isequal(szA, szB)
    if numel(A) == 1
        q = false(szB);
    else
        q = false(szA);
    end
else
    q = false(szA);
end

% classes different
if ~strcmp(class(A), class(B))
    
    % different !
    return;
end
    
% compare handles
if numel(A) == 1
    for ec = 1:numel(B)
        q(ec) = (A.L == B(ec).L);
    end
elseif numel(B) == 1
    for ec = 1:numel(A)
        q(ec) = (A(ec).L == B.L);
    end
else
    for ec = 1:numel(B)
        q(ec) = (A(ec).L == B(ec).L);
    end
end
